package com.kaguya.builder;

/**
 * 建造者模式 创建型 --传统
 */
public class BuilderTest {

    public static void main(String[] args) {

    }

}

/**
 * 建造者接口，具体的复杂对象构建方法
 */
interface MyDefaultBuilder{

    void setName(String name);
    void setCompany(String company);
    void setPart1(String part1);
    void setPart2(String part2);
    void setPart3(String part3);
    void setPart4(String part4);

    Product build();
}

/**
 * 复杂实体类
 */
class Product{

    private String name;
    private String company;
    private String part1;
    private String part2;
    private String part3;
    private String part4;

    @Override
    public String toString() {
        return "Product{" +
                "name='" + name + '\'' +
                ", company='" + company + '\'' +
                ", part1='" + part1 + '\'' +
                ", part2='" + part2 + '\'' +
                ", part3='" + part3 + '\'' +
                ", part4='" + part4 + '\'' +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCompany() {
        return company;
    }

    public void setCompany(String company) {
        this.company = company;
    }

    public String getPart1() {
        return part1;
    }

    public void setPart1(String part1) {
        this.part1 = part1;
    }

    public String getPart2() {
        return part2;
    }

    public void setPart2(String part2) {
        this.part2 = part2;
    }

    public String getPart3() {
        return part3;
    }

    public void setPart3(String part3) {
        this.part3 = part3;
    }

    public String getPart4() {
        return part4;
    }

    public void setPart4(String part4) {
        this.part4 = part4;
    }

    public Product() {
    }

    public Product(String name, String company, String part1, String part2, String part3, String part4) {
        this.name = name;
        this.company = company;
        this.part1 = part1;
        this.part2 = part2;
        this.part3 = part3;
        this.part4 = part4;
    }
}
